import { AndroidDevice } from '@/main/adb/android-device';

export type Dict<T = any> = { [key: string]: T }
export type Nullable<T> = T | null;

export interface MutationFunc<T = any> {
  (payload?: T): void;
}

export interface NonParamAction<R = void> {
  (): Promise<R>;
}

export interface ActionFunc<T = any, R = void> {
  (payload: T): Promise<R>;
}


export interface DeviceConfiguration {
  title?: string,
  record: {
    open: boolean,
    openMirror?: boolean,
    filepath?: string,
  },
  screen?: boolean,
  fixed?: boolean,
  control?: boolean,
  touch?: boolean,
  render?: boolean,
  bitRate?: number,
  maxSize?: number,
  crop: {
    x?: number,
    y?: number,
    height?: number,
    width?: number,
  }
}


export interface OpenDeviceSuccessEvent {
  deviceId: string;
  message: string;
}

export interface OpenDeviceErrorEvent {
  deviceId: string;
  error: {
    name: string;
    message: string
  };
}

export interface CloseDeviceEvent {
  deviceId: string;
  code: number;
}

export interface QueryDeviceEvent {
  changed: boolean;
  devices?: AndroidDevice[];
}
